d642afcbe8ca925d395499af560547500c144ae6,src/main/java/fr/minecraftforgefrance/updater/Updater.java,Updater,Updater,#String[]#,39
Before Change
public Updater(String[] args)
{
long start = System.currentTimeMillis();
System.out.println("Starting updater !");
final OptionParser parser = new OptionParser();
parser.allowsUnrecognizedOptions();
final OptionSpec<File> gameDirOption = parser.accepts("gameDir", "The game directory").withRequiredArg().ofType(File.class);
final OptionSpec<String> modpackOption = parser.accepts("version", "The version used").withRequiredArg();
final OptionSet options = parser.parse(args);
File mcDir = options.valueOf(gameDirOption);
String modpackName = options.valueOf(modpackOption);
File modPackDir = new File(new File(mcDir, "modpacks"), modpackName);
for(int i = 0; i < args.length; i++)
{
if("--gameDir".equals(args[i]))
{
args[i + 1] = modPackDir.getAbsolutePath();
}
}
arguments = args;
File modpackInfo = new File(modPackDir, modpackName + ".json");
if(!modpackInfo.exists())
{
JOptionPane.showMessageDialog(null, LANG.getTranslation("err.erroredprofile"), LANG.getTranslation("misc.error"), JOptionPane.ERROR_MESSAGE);
return;
}
JdomParser jsonParser = new JdomParser();
JsonRootNode jsonProfileData;
try
{
jsonProfileData = jsonParser.parse(Files.newReader(modpackInfo, Charsets.UTF_8));
}
catch(InvalidSyntaxException e)
{
JOptionPane.showMessageDialog(null, LANG.getTranslation("err.erroredprofile"), LANG.getTranslation("misc.error"), JOptionPane.ERROR_MESSAGE);
throw Throwables.propagate(e);
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, LANG.getTranslation("err.erroredprofile"), LANG.getTranslation("misc.error"), JOptionPane.ERROR_MESSAGE);
throw Throwables.propagate(e);
}
RemoteInfoReader.instance = new RemoteInfoReader(jsonProfileData.getStringValue("remote"));
if(!RemoteInfoReader.instance().init())
{
runMinecraft(args);
}
FileChecker checker = new FileChecker(mcDir);
if(!shouldUpdate(jsonProfileData.getStringValue("forge"), checker))
{
System.out.println(LANG.getTranslation("no.update.found"));
long end = System.currentTimeMillis();
System.out.println(String.format(LANG.getTranslation("update.checked.in"), (end - start)));
runMinecraft(args);
}
else
After Change
install.createFrame();
}
long end = System.currentTimeMillis();
Logger.info(String.format("Update checked in %d ms", (end - start)));
}